import request from '@/utils/request';
//引入类型约束
import type { AttrInfoModel } from './model/AttrListModel';
import type { categoryIdsModel } from './model/CategoryListModel';
// 属性列表的请求文件
//引入可以枚举的接口
enum Api {
  getAttrListApi = '/admin/product/attrInfoList',
  //删除属性的api
  deleteApi = '/admin/product/deleteAttr',
  //添加属性的api
  AddAttrApi ='/admin/product/saveAttrInfo'
}


//定义可以获取属性列表 的数据
  export const reqGetAttrListData = ({
  category1Id,
  category2Id,
  category3Id
  }: categoryIdsModel) => request.get < any, AttrInfoModel[] >(Api.getAttrListApi + `/${category1Id}/${category2Id}/${category3Id}`)

  //删除某属性的方法
export const reqDelteAttrData = (attrId: number) => request.delete<any,null>(Api.deleteApi + `/${attrId}`)
  //更新某属性 的方法
export const reqUpdateData = (AttrInfo:AttrInfoModel)=>request.post<any,null>(Api.AddAttrApi,AttrInfo)